import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common'
import { CompService } from './comp.service'
import { CreateCompDto } from './dto/create-comp.dto'
import { UpdateCompDto } from './dto/update-comp.dto'

@Controller('comp')
export class CompController {
  constructor(private readonly compService: CompService) {}

  @Post()
  create(@Body() createCompDto: CreateCompDto) {
    return this.compService.create(createCompDto)
  }

  @Get()
  async findAll(@Query() args = {}) {
    return await this.compService.findAll(args)
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.compService.findOne(+id)
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updateCompDto: UpdateCompDto) {
    return this.compService.update(+id, updateCompDto)
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.compService.remove(+id)
  }
}
